import logging

from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to

from sc.lib.base import BaseController, render
from sc.model.retrieval import RetrievalService

log = logging.getLogger(__name__)

repo = RetrievalService()

class CommentaryController(BaseController):
    def view(self):
        game_id = int(request.urlvars['game_id'])
        author = request.urlvars['author']

        commentary_set = repo.commentary_set(game_id, author)

        c.video_ids = commentary_set.video_ids
        c.video_count = len(c.video_ids)
        return render('/commentary_player.mako')
